<template >
  <div>
    天猫双11
    <h1>数字：{{$store.state.num}}</h1>
    <h1>数字：{{num}}</h1>
    <h1>flag：{{navflag}}</h1>
    <button @click="change()">用mutations改变</button>
    <button @click="numActions(10)">用actions改变</button>
  </div>
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'

export default {
  data () {
    return {
      kk: "11",
      color: "dd"
    }
  },
  created () {
    console.log(this.navflag)
  },
  computed: {
    // 将state的数据注入到计算属性中
    ...mapState(["num"]),
    ...mapGetters(["douNum", "navflag"]),
    hh () {
      return this.color
    }
  },
  methods: {
    ...mapMutations(["changenum"]),
    ...mapActions(["numActions"]),
    say () { },
    change () {
      this.changenum(5)
    }
  }
}
</script>
<style lang="less">
</style>